public class Player
{
    private int xPos, yPos; // physical (x,y) coordinate
	private int newX, newY;

	private boolean wall = false;
	private boolean increase = true;

    private String name; // name of player

    private int size = 16; // pixel size of player
    private int money = 0; // starting cash
	private int direction = 0;
	private int progress = 0;

	private Tile tile, newTile, wallTile; 
    private Tile[][] tiles; // array of every tile ever

	public Player (String name, Tile tile, Tile[][] tiles)
	{
	    this.name = name; // name
		this.tile = tile; // starting tile
		this.tiles = tiles; // array of tiles
		this.xPos = tile.getPosX(); // xpos of player, and the tile its on
		this.yPos = tile.getPosY(); // ypos + above
		this.money = money;
	}

	public void move(int direction)
		// manipulates player's position based on what keys the user pressed
	{
		newX = 0;
		newY = 0;
		
		// changes the newY or newX based on which direction its going in
		if (direction == 1) // w + up
			newY = -1;
		else if (direction == 2) // a + left
			newX = -1;
		else if (direction == 3) // d + right
			newX = 1;
		else if (direction == 4) // s + down
			newY = 1;

		// based on the above, and the (x,y), finds the new tile it should move on to.
		newTile = tiles[(int)xPos / 16 + newX][(int)yPos / 16 + newY];

		// sets (x,y) to new tile position
		xPos = tile.getPosX();
		yPos = tile.getPosY();
	}

    // These are all really self-explanatory. getters and setters, whatever.
	public int getXPos() // Gets x position
	{
		return this.xPos;
	}

	public int getYPos() // Gets y position
	{
		return this.yPos;
	}

	public int getDirection()
	{
		return this.direction;
	}

	public void setDirection(int direction)
	{
		this.direction = direction;
	}

	public int getMoney()
	{
		return this.money;
	}

	public void changeMoney(int m)
	{
		this.money += m;
	}

	public int getSize()
	{
		return this.size;
	}

	public void setTile(Tile tile)
	{
		this.tile = tile;
		this.xPos = tile.getPosX();
		this.yPos = tile.getPosY();
	}

    // For winning the game
	// These three methods help determine the progress of a player caputuring the opponents base

	public void setProgress(int progress)
	{
		this.progress = progress;
	}

	public void increaseProgress(int progress)
	{
		this.progress += progress;
	}

	public int getProgress()
	{
		return this.progress;
	}

	public void setIncrease (boolean increase)
	{
		this.increase = increase;
	}

	public boolean getIncrease()
	{
		return this.increase;
	}

	public String getName()
	{
		return this.name;
	}
}